home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / MAP Viewer / Engine.h < prev    next >
C/C++ Source or Header  |  2003-10-09  |  3KB  |  119 lines

  1. /*
  2. Half-Life MAP viewing utility.
  3. Copyright (C) 2003  Ryan Samuel Gregg
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. */
  19.  
  20. #pragma once
  21.  
  22. #include "stdafx.h"
  23. #include "Frustum.h"
  24. #include "Camera.h"
  25. #include "TextureManager.h"
  26. #include "WorldObject.h"
  27. #include "World.h"
  28. #include "PointFile.h"
  29.  
  30. __gc class CEngine
  31. {
  32. private:
  33.     // Handles
  34.     HWND hWND;
  35.     HDC hDC;
  36.     HGLRC hGLRC;
  37.  
  38.     // Engine
  39.     bool bRender;
  40.  
  41.     // Resources
  42.     unsigned int iFontBase;
  43.  
  44.     // Movement
  45.     Vertex2i vMouseOld;
  46.     Vertex2i vMouseNew;
  47.     bool bMousePressed;
  48.  
  49.     bool bW;
  50.     bool bA;
  51.     bool bS;
  52.     bool bD;
  53.     bool bShift;
  54.     bool bUp;
  55.     bool bDown;
  56.     bool bRight;
  57.     bool bLeft;
  58.     
  59.     // World
  60.     CConfig *Config;
  61.     CFrustum *Frustum;
  62.     CCamera *Camera;
  63.     CTextureManager *TextureManager;
  64.     CWorldObject *HighlightObject;
  65.     CWorld *World;
  66.     CPointFile *PointFile;
  67.  
  68.     // Parent
  69.     CRichTextBox *txtConsole;
  70.  
  71. public:
  72.     CEngine(CConfig *Config, CRichTextBox *txtConsole);
  73.  
  74.     bool Initialize(HWND hWND);
  75.     void Destroy();
  76.  
  77.     void Resize(int iWidth, int iHeight);
  78.  
  79.     void Paint();
  80.  
  81.     void LoadTextures();
  82.     void DestroyTextures();
  83.  
  84.     void EnterRenderLoop();
  85.     void ExitRenderLoop();
  86.  
  87.     void SetWorld(CWorld *World, CTextureManager *TextureManager);
  88.     CTextureManager *GetTextureManager();
  89.     void SetHighlightObject(CWorldObject *HighlightObject);
  90.     void SetPointFile(CPointFile *PointFile);
  91.     void UpdateTextureFilter();
  92.     void SetMousePosition(int X, int Y);
  93.     void SetMousePressed(bool bMousePressed);
  94.     void SetKeyPressed(System::Windows::Forms::Keys Key, bool bKeyPressed);
  95.  
  96.     bool TestExtension(String *sExtension);
  97.  
  98. private:
  99.     void MakeCurrent();
  100.     void MakeNotCurrent();
  101.  
  102.     void BuildFont(String *FontName);
  103.     void DestroyFont();
  104.  
  105.     void PreRenderLoop();
  106.  
  107.     void ClearBuffers();
  108.     void MoveCamera();
  109.     void SetCamera();
  110.     void CullScene();
  111.     void StartScene();
  112.     void EndScene();
  113.     void DrawScene();
  114.     void Start2D();
  115.     void DrawInfo();
  116.     void RenderText(String *Text, int X, int Y, Color3uc Color);
  117.     void End2D();
  118.     void RenderToScreen();
  119. };